Skip to content

fix: CBC output parsing, parse runtime & duality gap#446

Merged
siddharth-krishna merged 3 commits intoPyPSA:masterfrom
open-energy-transition:cbc-better-outputs
Apr 25, 2025
Merged

fix: CBC output parsing, parse runtime & duality gap#446
siddharth-krishna merged 3 commits intoPyPSA:masterfrom
open-energy-transition:cbc-better-outputs

Conversation

@siddharth-krishna
Copy link
Copy Markdown
Collaborator

Closes # (if applicable).

Changes proposed in this Pull Request

If CBC is run with the solver options {"ratioGap": mip_gap}, then the solution file it produces has a different header

Optimal (within gap tolerance) - objective value 443334.43058761

compared to what the current code expects:

Optimal - objective value 30.00000000

This causes linopy to incorrectly return a warning status without any objective value or other solution information. This PR updates the solution parser to be more robust.

I've also taken this opportunity to upgrade the CBC wrapper so that it parses the stdout of CBC and returns information on the solver runtime and the MIP duality gap. (Information we need for the solver benchmark.)

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@siddharth-krishna siddharth-krishna merged commit 6ea300f into PyPSA:master Apr 25, 2025
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants